//  -------------------- iSharePoint -------------------- //
// 
//  Company:	IT Complex, LLC
//  Project:	Smart.Common
//  File name:	IContext.cs
//  Developer:	Solomatov Igor
//  Created:	15.04.2012
// 
//  -------------------- iSharePoint -------------------- //

using System;
using System.Collections.Generic;
using Microsoft.SharePoint;
using Smart.Common.Entities;

namespace Smart.Common
{
	/// <summary>
	/// Scope context
	/// </summary>
	public interface IEntityScope : IDisposable
	{
		/// <summary>
		/// Scope Name
		/// </summary>
		string Name { get; }

		/// <summary>
		/// Metadata for Scope
		/// </summary>
		MetaScope Meta { get; }

		/// <summary>
		/// Mapper for current scope context
		/// </summary>
		IEntityMapper Mapper { get; }

		/// <summary>
		/// Facade-ListService mapping
		/// </summary>
		Dictionary<string, FacadeMappingInfo> FacadeMapping { get; }

		/// <summary>
		/// Return entity facade
		/// </summary>
		IEntityFacade<TEntityType> Get<TEntityType>(string facadeName) where TEntityType : Entity;

		/// <summary>
		/// List service for current scope context
		/// </summary>
		/// <param name="id">List ID</param>
		IListService<TEntityType> GetListService<TEntityType>(Guid id)
			where TEntityType : Entity;

		/// <summary>
		/// List service for current scope context
		/// </summary>
		/// <param name="listTitleOrUrl">List Title or Url or Guid</param>
		IListService<TEntityType> GetListService<TEntityType>(string listTitleOrUrl)
			where TEntityType : Entity;

		/// <summary>
		/// Return source
		/// </summary>
		object GetSource(MetaList list);

		/// <summary>
		/// Init scope with settings
		/// </summary>
		/// <param name="name">Name of Scope</param>
		/// <param name="settings">Settings, first parameter is scope type name</param>
		void InitScope(string name, params string[] settings);

		/// <summary>
		/// Return facade metadata
		/// </summary>
		MetaList GetMeta(string facadeName);

		/// <summary>
		/// Set default scope settings
		/// </summary>
		void SetDefaultSettings(IConfiguration config, SPWeb web, string scopeTypeName, string scopeName);
	}
}